<template>
  <div>
    <el-row>
      <el-form
        ref="elForm"
        :model="formData"
        :rules="rules"
        size="medium"
        label-width="100px"
      >
        <el-col :span="23">
          <el-row type="flex" justify="center" align="middle">
            <el-col :span="12">
              <el-form-item prop="field109">
                <template v-slot:label>
                  <el-tooltip
                    class="item"
                    effect="dark"
                    content="Top Left 提示文字"
                    placement="top-start"
                  >
                    <i class="el-icon-question"></i>
                  </el-tooltip>
                  密码
                </template>
                <el-input
                  v-model="formData.field109"
                  placeholder="请输入密码"
                  clearable
                  show-password
                  :style="{ width: '100%' }"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="23">
          <el-row type="flex" justify="center" align="top">
            <el-col :span="12">
              <el-form-item prop="field108">
                <template #label>
                  账号
                  <el-tooltip
                    class="item"
                    effect="dark"
                    content="Top Left 提示文字"
                    placement="top-start"
                  >
                    <i class="el-icon-question"></i>
                  </el-tooltip>
                </template>
                <el-input
                  v-model="formData.field108"
                  placeholder="请输入账号"
                  clearable
                  :style="{ width: '100%' }"
                >
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="23">
          <el-row type="flex" justify="center" align="middle">
            <el-col :span="8">
              <el-form-item label="按钮" prop="field115">
                <el-button type="primary" icon="el-icon-search" size="medium">
                  主要按钮
                </el-button>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="24">
          <el-row>
            <el-col :span="6">
              <el-form-item label="培训名称" prop="field118">
                <el-input
                  v-model="formData.field118"
                  placeholder="请输入培训名称"
                  clearable
                  :style="{ width: '100%' }"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="培训课件" prop="field119">
                <el-select
                  v-model="formData.field119"
                  placeholder="请输入培训课件"
                  clearable
                  :style="{ width: '100%' }"
                >
                  <el-option
                    v-for="(item, index) in field119Options"
                    :key="index"
                    :label="item.label"
                    :value="item.value"
                    :disabled="item.disabled"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="备注内容" prop="field120">
                <el-input
                  v-model="formData.field120"
                  type="textarea"
                  placeholder="请输入备注内容"
                  :autosize="{ minRows: 4, maxRows: 4 }"
                  :style="{ width: '100%' }"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="单行文本" prop="field121">
                <el-input
                  v-model="formData.field121"
                  placeholder="请输入单行文本"
                  clearable
                  :style="{ width: '100%' }"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="24">
          <el-form-item size="large">
            <el-button type="primary" @click="submitForm">提交</el-button>
            <el-button @click="resetForm">重置</el-button>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
  </div>
</template>
<script>
export default {
  name: "pagesDemo",
  components: {},
  props: [],
  data() {
    return {
      formData: {
        field109: undefined,
        field108: undefined,
        field115: 1111,
        field118: undefined,
        field119: undefined,
        field120: undefined,
        field121: undefined,
      },
      rules: {
        field109: [
          {
            required: true,
            message: "请输入密码",
            trigger: "blur",
          },
        ],
        field108: [
          {
            required: true,
            message: "请输入账号",
            trigger: "blur",
          },
        ],
        field118: [
          {
            required: true,
            message: "请输入培训名称",
            trigger: "blur",
          },
        ],
        field119: [
          {
            required: true,
            message: "请输入培训课件",
            trigger: "change",
          },
        ],
        field120: [
          {
            required: true,
            message: "请输入备注内容",
            trigger: "blur",
          },
          {
            pattern: /^.{6,30}$/,
            message: "---",
            trigger: "blur",
          },
        ],
        field121: [
          {
            required: true,
            message: "请输入单行文本",
            trigger: "blur",
          },
        ],
      },
      field119Options: [
        {
          label: "课件1",
          value: 1,
        },
        {
          label: "课件2",
          value: 2,
        },
      ],
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    submitForm() {
      this.$refs["elForm"].validate((valid) => {
        if (!valid) return;
        // TODO 提交表单
      });
    },
    resetForm() {
      this.$refs["elForm"].resetFields();
    },
  },
};
</script>
<style></style>
